import random

from django.http import HttpRequest, HttpResponse

# Create your views here.
from django.shortcuts import render


def index(request):
    # html = '<h1>hello django</h1>'
    codes = [
        'lll', 'wwww', 'xxxx', 'eeee', 'rrrr',
        'ddd', 'vvv', 'ggg', 'yyytt', 'ttt'
    ]
    code = random.sample(codes, 5)
    return render(request, 'index2.html', locals())


def task(request,id = 0):
    students = [
        {'name': 'huang', 'gender': 'man', 'grades': 88},
        {'name': 'huang1', 'gender': 'man', 'grades': 88},
        {'name': 'huang2', 'gender': 'man', 'grades': 60},
        {'name': 'huang3', 'gender': 'man', 'grades': 20},
        {'name': 'huang4', 'gender': 'man', 'grades': 30},
    ]
    context ={
        'id':id,
        'students':students
    }
    return render(request, 'task.html', context)
